Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mellanox_firmware] Add Mellanox firmware plugin #3407

Merged
merged 1 commit into from Dec 13, 2023
Merged

[mellanox_firmware] Add Mellanox firmware plugin #3407

merged 1 commit into from Dec 13, 2023

Conversation

ghost
Copy link

@ghost ghost commented Nov 6, 2023

This patch reports the output of the following Mellanox firmware commands:
mlxdump
mstconfig
mstdump
mstflint
mlxreg
mlxlink
mlxcables
mst

Additionally, if the user allows system changes, we will atempt to start the mst device, add the cables and stop the device in the end.


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3407
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Copy link
Member

@TurboTurtle TurboTurtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments below about the gating approach used - I think we can clean that up a bit, but overall I think the design of the plugin is acceptable once that is done and we have more details on what the bits gated by --allow-system-changes is wanting to do.

In addition to the comments below, please note that this project is attempting to transition/convert to f-strings for string substitution/interpolation, so let's look at replacing the legacy substitutions before merge.

sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Nov 28, 2023

@TurboTurtle thank you for the review and suggestions, I will try to revisit this PR tomorrow

@ghost ghost marked this pull request as draft November 28, 2023 21:29
@ghost ghost marked this pull request as ready for review November 29, 2023 00:02
@ghost
Copy link
Author

ghost commented Nov 29, 2023

I revisited the approach taken on how to mine for the packages and when to enable the plugin.

Thanks again for the guidance and reviews @TurboTurtle

@ghost ghost requested review from arif-ali and TurboTurtle November 29, 2023 00:05
return False
return self.MLNX_STRING in lspci['output']

def collect(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to overwrite collect method? Usually, whatever add_cmd_output you call in setup, the plugin will automatically collect, knowing the whole list of commands in advance.

Is there some reason of having collect_cmd_output in collect, instead of having the commands under add_cmd_output in setup?

(same applies to "no --allow-system-changes or if flint --version fails, return")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was suggested here: #3407 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since we're modifying system state, I think it best if we do this during collect(), and that requires using collect_cmd_output() for the just-in-time writing to the plugin dir.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, it makes sense (and I should read whole PR discussion before reviewing).

Maybe then it is worth having a comment abou the unusual approach in the code?

sos/report/plugins/mellanox_firmware.py Outdated Show resolved Hide resolved
return False
return self.MLNX_STRING in lspci['output']

def collect(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since we're modifying system state, I think it best if we do this during collect(), and that requires using collect_cmd_output() for the just-in-time writing to the plugin dir.

sos/report/plugins/mellanox_firmware.py Show resolved Hide resolved
sos/report/plugins/mellanox_firmware.py Show resolved Hide resolved
This patch reports the output of the following Mellanox firmware
commands:
mlxdump
mstconfig
mstdump
mstflint
mlxreg
mlxlink
mlxcables
mst

Additionally, if the user allows system changes, we will atempt
to start the mst device, add the cables and stop the device in
the end.

Signed-off-by: Alin-Gabriel Serdean <[email protected]>
Comment on lines +78 to +80
if device_list['status'] != 0:
# bail out if there no Mellanox PCI devices
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required over the check_enabled method in cases when user manually enables the plugin, ACK.

Copy link
Contributor

@pmoravec pmoravec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally ACK, maybe it is worth commenting the usage of collect method.

@TurboTurtle TurboTurtle merged commit 67fe73b into sosreport:main Dec 13, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants